package org.makcro.sms.services.chat.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name = "bulkmessage")
@NamedQueries({ @NamedQuery(name = "BulkMessage.FindByCoreId", query = "SELECT bm FROM BulkMessage bm WHERE bm.coreId = :coreId") })
public class BulkMessage implements Serializable {

	private static final long	serialVersionUID	= 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "Id")
	private Integer				id;

	@Column(name = "CoreId")
	private Long				coreId;

	@Column(name = "Receiver")
	private String				receiver;

	@Column(name = "Sender")
	private String				sender;

	@Column(name = "MessageText")
	private String				messageText;

	@Column(name = "SendingDate")
	@Temporal(TemporalType.TIMESTAMP)
	private Date				sendingDate;

	@Column(name = "Delivered")
	private boolean				delivered;

	@Column(name = "DeliveryReportDate")
	@Temporal(TemporalType.TIMESTAMP)
	private Date				deliveryReportDate;

	public Integer getId() {
		return id;
	}

	public Long getCoreId() {
		return coreId;
	}

	public void setCoreId(Long coreId) {
		this.coreId = coreId;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getReceiver() {
		return receiver;
	}

	public void setReceiver(String receiver) {
		this.receiver = receiver;
	}

	public String getSender() {
		return sender;
	}

	public void setSender(String sender) {
		this.sender = sender;
	}

	public String getMessageText() {
		return messageText;
	}

	public void setMessageText(String messageText) {
		this.messageText = messageText;
	}

	public Date getSendingDate() {
		return sendingDate;
	}

	public void setSendingDate(Date sendingDate) {
		this.sendingDate = sendingDate;
	}

	public boolean isDelivered() {
		return delivered;
	}

	public void setDelivered(boolean delivered) {
		this.delivered = delivered;
	}

	public Date getDeliveryReportDate() {
		return deliveryReportDate;
	}

	public void setDeliveryReportDate(Date deliveryReportDate) {
		this.deliveryReportDate = deliveryReportDate;
	}

	@Override
	public boolean equals(Object obj) {
		if (obj == null || !(obj instanceof BulkMessage)) {
			return false;
		}
		BulkMessage other = (BulkMessage) obj;
		if (this.id == other.getId()) {
			return true;
		}
		return false;
	}

	@Override
	public int hashCode() {
		return id.hashCode();
	}

}
